import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
//初始化数据
const state = {
	// 用户信息
	userInfo: "",
	// {
	// 	authorId:'',
	// 	authorName:'',
	// 	realName:'',
	// 	token:'',
	// 	coverUrl:'',
	// 	phone:''
	// },
	getters:{
		dosome:state =>{
			return state
		}
	},
	// 页面信息
	pageInfo: {
		editDisable:false,
		
	}
}

const getters = {
	userInfo: state => {
		return state.userInfo || JSON.parse(localStorage.getItem("userInfo"));
	}
}

const mutations = {
	setUserInfo ( state, userInfo) {
		state.userInfo = userInfo;

	}
}
let store = new Vuex.Store({
  state,
  getters,
  mutations
});

export default store
